package cn.xiyun.xiyuncc.MQ.consumer;

import cn.xiyun.xiyuncc.domain.MessageStation;
import cn.xiyun.xiyuncc.service.IMessageStationService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@RocketMQMessageListener(consumerGroup = "xiyuncc-service-course",topic = "STATION_MESSAGE",selectorExpression = "COURSE_SHELVING")
public class CourseGroundingConsumer implements RocketMQListener<String> {
    @Autowired
    private IMessageStationService messageStationService;
    @Override
    public void onMessage(String s) {

        MessageStation messageStation = new MessageStation();
        messageStation.setTitle("系统消息");
        messageStation.setSendTime(new Date());
        messageStation.setTitle("课程发布");
        messageStation.setContent("亲爱的用户您好，最新课程 <a href='H5大神班'> H5大神班 </a> 发布啦，点击课程了解详情");
        messageStation.setUserId(1L);

        messageStationService.insert(messageStation);

    }
}
